<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title">挪用选项</h4>
</div>
<form id="transfer-p-form" action="/xqc/inventory/transfer-p-ajax" method="post">
    <div class="modal-body">
        <div class="row">
            <div class="form-group" style="padding-bottom: 30px;">
                <label style="padding-top: 8px;text-align: right;" class="col-sm-3 control-label">申请站点</label>
                <div class="col-sm-8">
                    <select id="iarea_id" name="param[iarea_id]" required>
                        {{ getOptions(\App\Models\Basics\SysIArea::options()) }}
                    </select>
                </div>
            </div>
            <!-- <div class="form-group" style="padding-bottom: 30px;"> -->
                <!-- <label style="padding-top: 8px;text-align: right;" class="col-sm-3 control-label">扣减在途</label> -->
                <!-- <div class="col-sm-8"> -->
                    <!-- <input type="checkbox" class="grid-row-checkbox" id="deduct_transit" name="param[deduct_transit]" value="1" checked /> -->
                    <!-- <span class="help-block"><i class="fa fa-info-circle"></i>&nbsp;取消将不会扣减申请站点的在途库存，请谨慎操作</span> -->
                <!-- </div> -->
            <!-- </div> -->
        </div>
    </div>
    <div class="modal-footer">
        {{ csrf_field() }}
        <input type="hidden" id ="transfer_id" name="param[id]" value="{{ $id }}">
        <input type="hidden" name="action" value="transferConfirm">
        <button type="submit" class="btn btn-primary">前往挪用</button>
    </div>
</form>
<script language="JavaScript" type="text/javascript">
    $(function () {
        $("#iarea_id").select2({"allowClear":true, "placeholder":"请选择申请站点","width": '100%'});
        $('.grid-row-checkbox').iCheck({checkboxClass:'icheckbox_minimal-blue'});
        $("#deduct_transit").on('ifChanged', function(event) {
            if (this.checked) {
                $("#deduct_transit").val(1);
            } else {
                $("#deduct_transit").val(0);
            }
        });
        $("#transfer-p-form").ajaxForm(function (data) {
            if (typeof data === 'object') {
                if (data.status) {
                    $("#listLogisticsModal").modal('hide');
                    $(".modal-backdrop").remove();
                    $('body').removeClass('modal-open');
                    //toastr.success('提交成功 !');

                    var id = $("#transfer_id").val();
                    var areaId = $("#iarea_id").val();
                    // var dt = $("#deduct_transit").val();
                    // location.href = '/xqc/inventory/transfer-p-confirm?iarea_id=' + areaId + '&deduct_transit= '+ dt + '&id='+ id;
                    location.href = '/xqc/inventory/transfer-p-confirm?iarea_id=' + areaId + '&deduct_transit=1&id='+ id;
                } else {
                    swal(data.message, '', 'error');
                }
            }
        });
    });
</script>
